/**
 * @see [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxonbleconnectionstatechangecallback)
 */

export default function on_ble_connection_state_change() {
	return new Promise<{
		/**
		 * 蓝牙设备 id，参考 device 对象
		 */
		deviceId: string;
		/**
		 * 连接目前的状态
		 */
		connected: boolean;
	}>((resolve) => {
		wx.onBLEConnectionStateChanged((res) => {
			resolve(res);
		});
	});
}
